﻿using Domain.Entity;
using Domain.Event;
using Domain.ValueObject;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Domain
{
    /// <summary>
    /// 仓储接口
    /// </summary>
    public interface IUserDomainRepository
    {
        Task<User?> FindOneAsync(PhoneNumber phone);
        Task<User?> FindOneAsync(Guid guid);
        /// <summary>
        /// 增加用户登录记录
        /// </summary>
        /// <param name="phone"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        Task AddNewLoginHistoryAsync(PhoneNumber phone, string msg);
        /// <summary>
        /// 保存手机号及验证码
        /// </summary>
        /// <param name="phone"></param>
        /// <param name="code"></param>
        /// <returns></returns>
        Task SavePhoneCodeAsync(PhoneNumber phone, string code);

        /// <summary>
        /// 根据手机号获取验证码
        /// </summary>
        /// <param name="phone"></param>
        /// <returns></returns>
        Task<string?> GetCodeByPhoneAsync(PhoneNumber phone);

        /// <summary>
        /// 发布事件
        /// </summary>
        /// <param name="eventData"></param>
        /// <returns></returns>
        Task PublishEventAsync(UserAccessResultEvent eventData);
    }
}
